import collections


class Solution(object):
    def isIsomorphic(self, s, t):
        """
        :type s: str
        :type t: str
        :rtype: bool
        """
        map_dict = {}
        already_ord = set()
        for i in range(len(s)):
            if s[i] in map_dict:
                if map_dict[s[i]] != t[i]:
                    return False
            else:
                if t[i] not in already_ord:
                    map_dict[s[i]] = t[i]
                    already_ord.add(t[i])
                else:
                    return False
        return True


data = Solution()
s = "fok"
t = "ctt"
print(data.isIsomorphic(s, t))